-
Notifications
You must be signed in to change notification settings - Fork 52
Set up typechecking for DSL blocks #419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
6e28202 to
9449467
Compare
| @completed ||= false | ||
| end | ||
|
|
||
| #: { () [self: ConfigContext] -> void} -> void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This RBS type is what allows us to transparently rebind the self of the config and execute blocks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this
| module Roast | ||
| module DSL | ||
| class ConfigContext | ||
| #: (?Symbol?) {() [self: Roast::DSL::Cogs::Cmd::Config] -> void} -> void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handwriting RBIs is a stopgap - I'll investigate doing this via a Tapioca compiler next, which will also give the same benefits to third party cogs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it makes sense to get it working first in a bare-bones way before investing in automation
9449467 to
4bc20f6
Compare

Second part of new Roast architecture. Sorbet typechecking will be used as a way to statically validate Roast workflows. Between Ruby syntax checking and Sorbet static analysis, we should be able to completely eliminate the frustrating syntax gotchas with the current default YAML workflow definitions.
Note: RBI shims are a placeholder, these will be replaced in the future with a tapioca compiler that will be able to generate RBIs for any cog.
I experimented with generics to apply types, but it ended up requiring the writing of some really ugly code. RBI generation with tapioca gives more idiomatic Ruby code while still providing the validations we want to supply.